package com.info.zhiduoduo.repository.mapper.maker;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.info.zhiduoduo.repository.entity.maker.MakerAlipayAccountOrder;

import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  受托人创客的企业支付宝转账支付等订单表, 与支付宝平台上的订单一一对应 Mapper 接口
 * </p>
 *
 * @author bob
 * @since 2021-07-11
 */
public interface MakerAlipayAccountOrderMapper extends BaseMapper<MakerAlipayAccountOrder> {

	@Select(" select id from zdd_maker_alipay_account_order where state in(1,3,6) and type = #{type} and createtime <= DATE_SUB(NOW(),INTERVAL 2 MINUTE) ")
	List<Integer> listProcessingOrderIds(int type);

	@Select(" select * from zdd_maker_alipay_account_order where project_id = #{projectId} and repay = 0 order by id desc limit 1")
	MakerAlipayAccountOrder getOrderByprojectId(int projectId);

	@Select(" select * from zdd_maker_alipay_account_order where state = 2 and receipt_file_id = '' ")
	List<MakerAlipayAccountOrder> listFinishedOrderWithoutFileId();

	@Select(" select * from zdd_maker_alipay_account_order where state = 2 and receipt_file_id != '' and receipt_download_url = '' ")
	List<MakerAlipayAccountOrder> listFinishedOrderWithoutDownloadUrl();
}
